<template>
  <div>
    <!-- <CategorySelector :isShowAttrList="isShowAttrList" /> -->
    <!-- 
      但 isShowAttrList 为 false 的时候，显示添加属性组件，此时需要禁用，得到true
     -->
    <CategorySelector :disabled="!isShowAttrList" />
    <!-- 
      切换显示两个组件
        v-show
        v-if

      $event 代表触发事件回调函数的第一个参数
    -->
    <AttrList
      v-if="isShowAttrList"
      @setIsShowAttrList="isShowAttrList = $event"
    />
    <AddOrUpdateAttr v-else @setIsShowAttrList="isShowAttrList = $event" />
  </div>
</template>

<script lang="ts">
export default {
  name: "XAttr",
};
</script>

<script lang="ts" setup>
import { ref } from "vue";
import CategorySelector from "@/components/CategorySelector/index.vue";
import AttrList from "./components/AttrList.vue";
import AddOrUpdateAttr from "./components/AddOrUpdateAttr.vue";

const isShowAttrList = ref(true);
</script>

<style scoped></style>
